﻿using CrateMayhem.Common.Data;
using CrateMayhem.Common.IoC;
using CrateMayhem.Common.Services;
using CrateMayhem.Common.ViewModel;
using CrateMayhem.Desktop.Data;
using CrateMayhem.Desktop.Services;

namespace CrateMayhem.Desktop
{
    internal static class Global
    {
        internal static Container Container { get; private set; }

        internal static void Init()
        {
            Container = new Container();
            Container.AddComponent<ISettingsRepository, SettingsRepository>();
            Container.AddComponent<IWorldRepository, WorldRepository>();
            Container.AddComponent<IAutoCloseDialogService, AutoCloseDialogService>();
            Container.AddComponent<IGameService, GameService>();
            Container.AddComponent<IGameSettingsService, GameSettingsService>();
            Container.AddComponent<IMessageService, MessageService>();
            Container.AddComponent<IServiceFactory, ServiceFactory>();
            Container.AddComponent<ViewModelBase, ViewModel.GameViewModel>(typeof(ViewModel.GameViewModel).Name);
            Container.AddComponent<ViewModelBase, ViewModel.GameControlViewModel>(typeof(ViewModel.GameControlViewModel).Name);
            Container.AddComponent<ViewModelBase, OptionsViewModel>(typeof(OptionsViewModel).Name);
        }
    }
}